package com.ruoyi.fs.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.fs.mapper.FsCapitalMapper;
import com.ruoyi.fs.domain.FsCapital;
import com.ruoyi.fs.service.IFsCapitalService;

/**
 * 资方信息Service业务层处理
 * 
 * @author hero
 * @date 2024-08-27
 */
@Service
public class FsCapitalServiceImpl implements IFsCapitalService 
{
    @Autowired
    private FsCapitalMapper fsCapitalMapper;

    /**
     * 查询资方信息
     * 
     * @param id 资方信息主键
     * @return 资方信息
     */
    @Override
    public FsCapital selectFsCapitalById(Long id)
    {
        return fsCapitalMapper.selectFsCapitalById(id);
    }
    /**
     * 查询资方信息
     *
     * @param name 资方信息主键
     * @return 资方信息
     */
    @Override
    public FsCapital selectFsCapitalByName(String name)
    {
        FsCapital query = new FsCapital();
        query.setDwmc(name);
        List<FsCapital> list = fsCapitalMapper.selectFsCapitalList(query);
        if (list.isEmpty()) {
            return null;
        } else {
            return list.get(0);
        }
    }

    /**
     * 查询资方信息列表
     * 
     * @param fsCapital 资方信息
     * @return 资方信息
     */
    @Override
    public List<FsCapital> selectFsCapitalList(FsCapital fsCapital)
    {
        return fsCapitalMapper.selectFsCapitalList(fsCapital);
    }

    /**
     * 新增资方信息
     * 
     * @param fsCapital 资方信息
     * @return 结果
     */
    @Override
    public int insertFsCapital(FsCapital fsCapital)
    {
        fsCapital.setCreateTime(DateUtils.getNowDate());
        return fsCapitalMapper.insertFsCapital(fsCapital);
    }

    /**
     * 修改资方信息
     * 
     * @param fsCapital 资方信息
     * @return 结果
     */
    @Override
    public int updateFsCapital(FsCapital fsCapital)
    {
        fsCapital.setUpdateTime(DateUtils.getNowDate());
        return fsCapitalMapper.updateFsCapital(fsCapital);
    }

    /**
     * 批量删除资方信息
     * 
     * @param ids 需要删除的资方信息主键
     * @return 结果
     */
    @Override
    public int deleteFsCapitalByIds(Long[] ids)
    {
        return fsCapitalMapper.deleteFsCapitalByIds(ids);
    }

    /**
     * 删除资方信息信息
     * 
     * @param id 资方信息主键
     * @return 结果
     */
    @Override
    public int deleteFsCapitalById(Long id)
    {
        return fsCapitalMapper.deleteFsCapitalById(id);
    }
}
